package 二分查找;

public class Solution3 {
    //https://www.nowcoder.com/practice/fcf87540c4f347bcb4cf720b5b350c76
    public int findPeakElement (int[] nums) {
        if (nums.length == 1) {
            return 0;
        }
        if (nums[0] > nums[1]) {
            return 0;
        }
        int mid = 1;
        int late = 2;
        while (late <= nums.length - 1) {
            if (nums[mid] > nums[late]) {
                return mid;
            }
            mid++;
            late++;
        }
        return nums.length - 1;
    }

}
